package com.chisheng.caa.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.chisheng.caa.mapper.CourseTypeMapper;
import com.chisheng.caa.pojo.dto.CourseTypeDTO;
import com.chisheng.caa.service.CourseTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class CourseTypeServiceImpl implements CourseTypeService {

    @Resource
    private CourseTypeMapper courseTypeMapper;

    @Override
    public List<CourseTypeDTO> getCourseTypeList() {
        return courseTypeMapper.selectList(null)
                .stream()
                .map(e -> BeanUtil.copyProperties(e, CourseTypeDTO.class))
                .collect(Collectors.toList());
    }

}
